//
//  HEHealthRecordCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/12/10.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEHealthRecordCell.h"

@interface HEHealthRecordCell ()

@property (nonatomic, strong) UILabel *nameLb;
@property (nonatomic, strong) UILabel *descLb;

@end

@implementation HEHealthRecordCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self initUI];
    }
    return self;
}

- (void)initUI {
    UIView *cardView = [UIView new];
    cardView.backgroundColor = [UIColor colorWithRed:62/255.0 green:139/255.0 blue:248/255.0 alpha:1.0];
    cardView.layer.shadowColor = [UIColor colorWithRed:58/255.0 green:58/255.0 blue:58/255.0 alpha:0.08].CGColor;
    cardView.layer.shadowOffset = CGSizeMake(0,2);
    cardView.layer.shadowOpacity = 1;
    cardView.layer.shadowRadius = 4;
    cardView.layer.cornerRadius = 6;
    cardView.layer.masksToBounds = YES;
    [self.contentView addSubview:cardView];
    
    [cardView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(0);
        make.left.equalTo(self.contentView).mas_offset(0);
        make.right.equalTo(self.contentView).mas_offset(0);
        make.bottom.equalTo(self.contentView).mas_offset(-0);
    }];
    
    
    // 姓名
    UILabel *nameLb = [UILabel new];
    [cardView addSubview:nameLb];
    nameLb.text = @"-";
    nameLb.font = DYBlodFont(18);
    nameLb.textColor = KWhiteColor;
    _nameLb = nameLb;
    
    [nameLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(cardView).mas_offset(10);
        make.left.equalTo(cardView).mas_offset(10);
        make.right.equalTo(cardView).mas_offset(-10);
    }];
 
    // 描述
    UILabel *descLb = [UILabel new];
    [cardView addSubview:descLb];
    descLb.text = [NSString stringWithFormat:@"本人    %d岁", 18];
    descLb.font = DYFont(15);
    descLb.textColor = KWhiteColor;
    _descLb = descLb;

    [descLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(cardView).mas_offset(10);
        make.right.equalTo(cardView).mas_offset(-10);
        make.bottom.equalTo(cardView).mas_offset(-10);
    }];
    
//    [self refreData];
}

- (void)refreData:(HEBindUserModel *)model {
//    HEHealthArchiveModel *model = [UserManager sharedUserManager].archiveInfo;
//    _nameLb.text = model.xm;
//    _descLb.text = [NSString stringWithFormat:@"本人    %@岁", IsNotNull(model.Kage)];
    
    _nameLb.text = model.realname;
    _descLb.text = [NSString stringWithFormat:@"%@ %@", model.relations, model.Kage];
}

@end
